/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package models;

/**
 *
 * @author root
 */
public class TextChanges 
{
    private final String subString;
    private final int offset, size;
    private boolean type;
    
    
    /**
     * Text alterations
     * @param subString text changed
     * @param offset position of the alteration
     * @param size size of change
     * @param type add or removal (add = true) (rmv = false)
     */
    public TextChanges(String subString, int offset, int size, boolean type)
    {
        this.subString = subString;
        this.offset = offset;
        this.size = size;
        this.type = type;
        
    }
    
    public void getChanges()
    {
        System.out.println("-=-=-=-=-=-=-=-=\n"
                + "TEXT: "+subString+
                "\nCURSOR: "+offset+
                "\nSIZE: "+size+
                "\nTYPE:"+type);
    }

    public boolean isType() {
        return type;
    }
    
    public String getText() {
        return subString;
    }

    public int getOffset() {
        return offset;
    }

    public int getSize() {
        return size;
    }

    /**
     *Invert add to remove OR the remove to add
     * @return this object inverted
     */
    public TextChanges invert()
    {
        this.type = !this.type;
        return this;
    }
    
    
    
    
  
    
}
